/*************************************************************************
	> File Name: VoltageLimiter.h
	> Author: 
	> Mail: 
	> Created Time: 2018/1/23 Tue 10:16
	> Version     :
 ************************************************************************/

#ifndef _VOLTAGELIMITER_H
#define _VOLTAGELIMITER_H
#include <stdint.h>

#define VOL_DEC_NUMBER (8)
#define VOL_DEC_ENABLE_MASK (0X01)
#define VOL_DEC_ENABLE (0x01)

typedef struct VoltageLimiterCfg{
    uint16_t moduleEnable;
    peakDetCfg_t pd_cfg;
    curveCfg_t   gcur_cfg;
    smoothCfg_t  gs_cfg;
}volLimiterCfg_t;
typedef struct VoltageLimiterParams{
    peakDetParams_t pd_params;
    curveParams_t  gcur_params;
    smoothParams_t  gs_params;
}volLimiterParams_t;

//voltage limiter process
void volLimiterProcess(int32_t *data,volLimiterCfg_t *cfg,uint16_t dataCnt);
//Init voltage limiter
int voltageLimiterInit(volLimiterCfg_t *cfg);
//Reset voltage limiter
int voltageLimiterReset(volLimiterCfg_t *cfg);
//Set voltage limiter parameter
int voltageLimiterSetParams(volLimiterCfg_t *cfg,volLimiterParams_t *params,int32_t threshold);
//Get voltage limiter parameter
int voltageLimiterGetParams(volLimiterCfg_t *cfg,volLimiterParams_t *params,int32_t *threshold);

#endif
